/*
 * Copyright (C) 2008 Universidade Federal de Campina Grande
 *  
 * This file is part of OurGrid. 
 *
 * OurGrid is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free 
 * Software Foundation, either version 3 of the License, or (at your option) 
 * any later version. 
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details. 
 * 
 * You should have received a copy of the GNU Lesser General Public License 
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 */
package org.ourgrid.acceptance.worker;

import org.junit.Before;
import org.junit.Test;
import org.ourgrid.acceptance.util.worker.Req_004_Util;
import org.ourgrid.acceptance.util.worker.Req_094_Util;
import org.ourgrid.common.interfaces.to.WorkerStatus;
import org.ourgrid.reqtrace.ReqTest;

@ReqTest(reqs="REQ094")
public class Req_094_Test extends WorkerAcceptanceTestCase {
	
	private Req_004_Util req_004_Util = new Req_004_Util(getComponentContext());
	private Req_094_Util req_094_Util = new Req_094_Util(getComponentContext());
	
	@Before
	public void setUp() throws Exception {
		super.setUp();
		workerAcceptanceUtil.simulateAuthentication();
	}
	
	/**
	 * This test contains the following steps:
	 *
  	 * 1. Start a Worker with the idleness detector enabled
   	 * 2. Get Worker status;
	 *         1. Verify if the worker status is OWNER
	 */
	@ReqTest(test=" AT-094.1", reqs="REQ094")
	@Test public void test_at_094_1_WorkerStatusWithIdlenessDetector() throws Exception {
		//Start worker
		req_004_Util.startWorker(true);
		
		//Verify if the worker status is OWNER
		req_094_Util.getWorkerStatus(WorkerStatus.OWNER);

	} 
	
	/**
	 * This test contains the following steps:
	 * 
	 * 1. Start a Worker with the idleness detector disabled
	 * 2. Get Worker status;
	 *          1. Verify if the worker status is IDLE
	 */
	@ReqTest(test=" AT-094.2", reqs="REQ094")
	@Test public void test_at_094_2_WorkerStatusWithoutIdlenessDetector() throws Exception {
		//Start worker
		req_004_Util.startWorker();
		
		//TODO set the idleness detector
		
		//Verify if the worker status is IDLE
		req_094_Util.getWorkerStatus(WorkerStatus.IDLE);
	}
}